package com.cfg;

/**
 * @author <a href="15226116300@163.com">王廷俊</a>
 * @Description
 * @Date 2024-11-12
 */
public class ServiceFactory {
    
    protected EngineConfigurationImpl engineConfiguration;
    
    public ServiceFactory(EngineConfigurationImpl engineConfiguration) {
        this.engineConfiguration = engineConfiguration;
    }
    
    /**
     * craete service instance
     *
     * @param clazz service class
     * @return service instance
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    public <T extends Service> T createService(Class<T> clazz) throws IllegalAccessException, InstantiationException {
        T service = getProxyService(clazz);
        
        return service;
    }
    
    protected <T extends Service> T getProxyService(Class<T> var1) {
        ServiceInvocationHandler var2 = new ServiceInvocationHandler();
        Service var3 = (Service) var2.getProxy(var1);
        return (T) var3;
    }
}
